/**
 * Header file.
 *
 * @file dspmap.h
 * @version $Id$
 *
 */

/* Copyright 2014 Optimum Semiconductor Technologies, Inc.
 * All rights reserved.
 */
#ifndef __DSPMAP_H__
#define __DSPMAP_H__

//#define KERNEL_UCLINUX 1

#ifdef KERNEL_UCLINUX
#include <linux/types.h>
#include <linux/kernel.h>
#include <linux/sched.h>
#include <asm/io.h>
#include "ost_interface.h"
#else
#include <stdlib.h>
#include <stdio.h>
#include <stdint.h>
#include <stddef.h>
#endif

#define TEST_DSP    0

/* 浠嶢RM鍚姩鏃朵笌DSP杩涜浜や簰鐨勪环鍊笺�*/
#ifdef KERNEL_UCLINUX

	/* DSP鍐呭瓨鑼冨洿 */
	#define DSP_MEMORY_START    0x40010000
	#define DSP_MEMORY_END        0x42000000

	/* DSP鍐呮牳鍐呭瓨澶у皬浠ュ瓧鑺備负鍗曚綅銆�/
	#define DSP_CORE_MEMORY_SIZE (256*1024)

	/* DSP鍐呴儴鏁版嵁瀛樺偍鍣�*/
	#define DSP_MEMORY_1        0x90000000
	#define DSP_MEMORY_2        0xA0000000
	#define DSP_MEMORY_3        0xB0000000

	/* 妫�祴鍒癉SP浠ｇ爜鏄惁琚姞杞�*/
	#define BPB_LIST_ADDRESS (0x40800000-4096)

	/* 鐗╃悊鍐呭瓨閮ㄥ垎鍒嗛厤ARM-DSP鍏变韩闃熷垪 */
	#define DSPARM_PHY_START_SHARED_BLOCK 0x41000000
	#define DSPARM_PHY_SIZE_SHARED_BLOCK  0x00100000

	/* 娉ㄥ唽鍚姩DSP鎵ц銆�*/
	#define DSP_START_EXECUTION 0x8C000030
	#define DSP_START_EXECUTION_VAL 0xBF

#endif

#if defined(KERNEL_UCLINUX)
    #define VIR_TO_PHY(x) virt_to_phys((void *)(x))
    #define PHY_TO_VIR(x) phys_to_virt((uint32_t)(x))
    #define PHY_TO_ARM(x,s) ioremap((unsigned long)(x),s)
    #define unPHY_TO_ARM(x) iounmap(x)
#else
    #define VIR_TO_PHY(x) ((uint32_t)(x))
    #define PHY_TO_VIR(x) ((void *)(x))
    #define PHY_TO_ARM(x,s) ((void *)(x))
    #define unPHY_TO_ARM(x)
#endif

/* ARMxDSP闃熷垪鍜孲andBlaster鍏变韩缂撳啿姹犻槦鍒楃殑鍐呭瓨鍒嗛厤銆�*/
/* 鍒嗛厤浠呭湪ARM绔繘琛�*/
#if defined(KERNEL_UCLINUX)
    #define mq_alloc(s) dsparm_alloc(s)
    #define mq_free(p) dsparm_free(p)
#else
    #define mq_alloc(s) malloc(s)
    #define mq_free(p) free(p)
#endif

#endif // __DSPMAP_H__
